<?php

class api extends spController{
	
	function save(){
		$data = array(
			'username'	=>	$this->spArgs('username'),
			'phone'	=>	$this->spArgs('phone'),
			'comefrom'	=>	$this->spArgs('comefrom','self'),
		);
		if(empty($data['username'])||empty($data['phone'])){
			FN::_Ajax_return(false,'参数不完成');
		}
		$oModel = spClass('wx_order');
		$ct = $oModel->findCount(array('phone'=>$data['phone']));
		if($ct>0){
			FN::_Ajax_return(false,'此手机号码已参与过报名');	
		}
		$rs = $oModel->create($data);
		if($rs){
			FN::_Ajax_return(true,'您已成功提交报名信息');	
		}else{
			FN::_Ajax_return(false,'报名数据保存失败,请稍后重试');	
		}
	}
	
}
?>